<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core">
    <h:head>
        <title>#{user.action}</title>
        <script type="text/javascript">
		function switchOffCurrentDateValidation() {
                var setCurrentDate = Boolean(document.getElementById("setCurrentDate").checked);
                if(setCurrentDate) {
                    document.getElementById("regDate").value="";
                }
            }
	</script>
    </h:head>
    <h:body>
        <h3>Enter data:</h3>
        <h:form prependId="false">
            <p>
                Name: &nbsp;&nbsp;
                <h:inputText id="name" value="#{user.name}" size="10"
                             validatorMessage="Attribute 'Name' is required">
                    <f:validateRequired/>
                </h:inputText>
            </p>
            <p>
                Login: &nbsp;&nbsp;
                <h:inputText value="#{user.login}" size="10"
                             validatorMessage="Attribute 'Login' is required">
                    <f:validateRequired/>
                </h:inputText>
            </p>
            <p>
                Password: &nbsp;&nbsp;
                <h:inputText value="#{user.password}" size="10" required="true"
                             validatorMessage="Attribute 'Password' is required">
                    <f:validateRequired/>
                </h:inputText>
            </p>
            <p>
                Registration date (dd-MM-yyyy HH:mm:ss):<br/>
                Set current date
                <h:selectBooleanCheckbox id="setCurrentDate" value="#{user.setCurrentDate}"/><br/>
                <h:inputText id="regDate" value="#{user.registrationDate}"
                             converterMessage="Wrong date format. Date format must look like dd-MM-yyyy HH:mm:ss. Example: 22-09-2011 19:53:47">
                    <f:converter converterId="ru.ssau.managed.SetDateConverter"/>
                </h:inputText>
            </p>
            <p>
                Info:
                <br/>
                <h:inputTextarea rows="4" cols="25" value="#{user.info}"/>
            </p>
            <h:commandButton value="#{user.action}" actionListener="#{user.doAction}" action="#{user.getAction}"/>
        </h:form>
    </h:body>
</html>

